package koala.kuangjiademo.data;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

import com.wwgps.ect.acivity.checkin.CheckInActivity;

public class FunctionItem {
    public int icon;
    public String name;
    public Class<? extends Activity> action;

    public FunctionItem(int icon, String name, Class<? extends Activity> action) {
        this.icon = icon;
        this.name = name;
        this.action = action;
    }

    public void start(Context context) {
        if (action == null) {
            Toast.makeText(context, "服务暂未开通", Toast.LENGTH_SHORT).show();
        } else if (CheckInActivity.class.equals(action)) {
            CheckInActivity.start(context);
        } else {
            context.startActivity(new Intent(context, action));
        }
    }
}
